package com.muyu.product.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.muyu.common.core.annotation.Excel;
import com.muyu.product.domain.req.CommentLikeInfoQueryReq;
import com.muyu.product.domain.req.CommentLikeInfoSaveReq;
import com.muyu.product.domain.req.CommentLikeInfoEditReq;
import com.muyu.common.core.web.domain.BaseEntity;

/**
 * 评论点赞对象 comment_like_info
 *
 * @author DongZeLiang
 * @date 2024-02-27
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("comment_like_info")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "CommentLikeInfo", description = "评论点赞")
public class CommentLikeInfo extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 主键 */
    @TableId(value = "id",type = IdType.AUTO)
    @ApiModelProperty(name = "主键", value = "主键")
    private Long id;

    /** 评论id */
    @Excel(name = "评论id")
    @ApiModelProperty(name = "评论id", value = "评论id", required = true)
    private Long commentId;

    /** 点赞人id */
    @Excel(name = "点赞人id")
    @ApiModelProperty(name = "点赞人id", value = "点赞人id", required = true)
    private Long userId;

    /**
    * 查询构造器
    */
    public static CommentLikeInfo queryBuild( CommentLikeInfoQueryReq commentLikeInfoQueryReq){
        return CommentLikeInfo.builder()
                .commentId(commentLikeInfoQueryReq.getCommentId())
                .userId(commentLikeInfoQueryReq.getUserId())
                .build();
    }

    /**
    * 添加构造器
    */
    public static CommentLikeInfo saveBuild(CommentLikeInfoSaveReq commentLikeInfoSaveReq){
        return CommentLikeInfo.builder()
                .commentId(commentLikeInfoSaveReq.getCommentId())
                .userId(commentLikeInfoSaveReq.getUserId())
                .build();
    }

    /**
    * 修改构造器
    */
    public static CommentLikeInfo editBuild(Long id, CommentLikeInfoEditReq commentLikeInfoEditReq){
        return CommentLikeInfo.builder()
            .id(id)
                .commentId(commentLikeInfoEditReq.getCommentId())
                .userId(commentLikeInfoEditReq.getUserId())
                .build();
    }

}
